﻿using Abp.Domain.Entities.Auditing;
using FutureApp.Users;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace FutureApp.Shop
{
    /// <summary>
    /// 商品模型特征属性组合
    /// </summary>
    [Table("GoodsMouldAssembles")]
    public class GoodsMouldAssemble : CreationAuditedEntity<Guid, User>
    {
        /// <summary>
        /// 商品模型Id
        /// </summary>
        [Required]
        public virtual Guid MouldId { get; set; }

        /// <summary>
        /// 商品模型
        /// </summary>
        [ForeignKey(nameof(MouldId))]
        public virtual GoodsMould Mould { get; set; }

        /// <summary>
        /// 商品特征属性Id
        /// </summary>
        [Required]
        public virtual Guid AttibuteId { get; set; }

        /// <summary>
        /// 商品特征属性
        /// </summary>
        [ForeignKey(nameof(AttibuteId))]
        public virtual GoodsAttribute Attribute { get; set; }

        /// <summary>
        /// 商品特征属性别名
        /// </summary>
        [StringLength(GoodsAttribute.MaxNameLength)]
        public string AttributeAlias { get; set; }

        /// <summary>
        /// 排序号
        /// </summary>
        [Required]
        public virtual int Order { get; set; } = 0;
    }
}
